<template>
    <div class="participant wrap-table userDate">
        <div class="headerTop_ukl">
            <ul class="clearfix">
                <li>
                    <p class="p1">
                        <img src="../../assets/images/icon_yanjiuduixiang.png" alt=""/>
                        <span>研究对象</span>
                    </p>
                    <p class="p3">
                        {{userBasic.Surname}}({{userBasic.ResearchNo}})
                    </p>
                </li>
                <li>
                    <p class="p1">
                        <img src="../../assets/images/icon_ganyuzu.png" alt=""/>
                        {{userBasic.GroupType |GroupType}}
                    </p>
                    <p  class="p3" v-if="userBasic.Period!='3'">
                        <span v-if="userBasic.GroupType==1">
                            {{userBasic.IntensityOfIntervention |IntensityOfIntervention}}
                        </span>
                    </p>
                    <p  class="p3" v-else>
                         <span v-if="userBasic.GroupType==1">
                            {{userBasic.ChildIntensityOfIntervention |IntensityOfIntervention}}
                        </span>
                    </p>
                </li>
                <li >
                    <p class="p1"><img src="../../assets/images/icon_huaiyunqi.png" alt=""/>{{userBasic.Period |Period}}</p>
                    <p  class="p3"><span v-if="userBasic.Period==2">预产期：{{userBasic.ExpectedDate}},{{userBasic.PregnancyWeek}}</span></p>
                    <p class="p3"><span v-if="userBasic.Period==3">出生日期：{{userBasic.ChildBirthDate}},{{userBasic.ChildAge}}, {{userBasic.ChildSex|ChildSex}} </span></p>
                    <p class="p3"><span v-if="userBasic.Period==4">出生日期：{{userBasic.ChildBirthDate}},{{getChildAge2(userBasic.ChildBirthDate)}}, {{userBasic.ChildSex|ChildSex}} </span></p>
                </li>
            </ul>
        </div>
        <!--更多操作-重置日程-切换日程数据-->
        <div class="heaterOp" >
            <el-dropdown  trigger="click" @command="resetCommand">
                  <span class="el-dropdown-link">
                    更多操作<i class="el-icon-arrow-down el-icon--right"></i>
                  </span>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item command="a" v-if="RoleGroup<=2">重置日程</el-dropdown-item>
                    <el-dropdown-item command="b">孕前期日程</el-dropdown-item>
                    <el-dropdown-item command="c">怀孕期日程</el-dropdown-item>
                    <el-dropdown-item command="d">儿童期（CH1）</el-dropdown-item>
                    <el-dropdown-item command="e">儿童期（CH2）</el-dropdown-item>
                </el-dropdown-menu>
            </el-dropdown>
        </div>
        <template>
            <el-table
                    :data="tableData"
                    class="scrollTable"
                    border
                    v-loading="loading"
                    :height="maxHeight"
                    :empty-text="emptyText"
                    element-loading-text="加载中"
                    style="width: 100%">
                <el-table-column align="center" label="" width="88" prop="week">
                    <template slot-scope="scope">
                        <span :class="'A'+scope.$index">{{scope.row.week}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="one" align="center" :label="tableList.one" min-width="150" >
                    <template slot-scope="scope">
                        <div class="scopeDrop" @click="getItem(scope.row.one)">
                            <el-dropdown  trigger="click" @command="handleCommand" >
                            <span class="el-dropdown-link" >
                                <span v-if="scope.row.one.ScheduleDate!==''">
                                    {{scope.row.one.ScheduleDate}}
                                </span>
                                <span v-else>
                                    <span v-if="scope.row.one.things[0] &&scope.row.one.things[0].ScheduleDate!==undefined">
                                        {{scope.row.one.things[0].ScheduleDate}}
                                    </span>
                                    <span v-else>添加时间</span>
                                </span>
                                <i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                                <el-dropdown-menu slot="dropdown">
                                    <el-dropdown-item command="1">调整日期</el-dropdown-item>
                                    <el-dropdown-item command="2">添加事项</el-dropdown-item>
                                    <el-dropdown-item command="3">全部完成</el-dropdown-item>
                                </el-dropdown-menu>
                            </el-dropdown>
                        </div>
                        <ul class="scopeUl">
                            <li v-for="(item,mop) in scope.row.one.things" :key="mop" @click="getDetails(item)">
                                <el-dropdown trigger="click"  @command="handleCommandSP">
                                  <span class="el-dropdown-link">
                                    <!---->
                                    <span class="span-radio" :style="{background:item.Color}"></span>
                                      <i v-if="item.State==1" :class="{iconOnes:item.State==1}" style="color: #4BCD61" class="el-icon-success color-check"></i>
                                      <i v-else-if="item.State==0" style="color: #DDDDDF" class="el-icon-remove-outline color-check"></i>
                                      <i v-else-if="item.State==3" class="el-icon-error" style="color:red"></i>
                                      <i v-else-if="item.State==2" class="el-icon-warning" style="color:#FF9900"></i>
                                      <i v-else class="el-icon-remove-outline" style="color: #DDDDDF"></i>
                                      <span :class="{iconOne:item.AppointState==0 ||item.AppointState==undefined,iconTwo:item.AppointState==1,iconThr:item.AppointState==2}">{{item.ScheduleName}}</span>
                                      <span v-if="item.FollowUpType=='2'&&item.NeedFollowUp=='1'">
                                        <img class="img-follow" :src="icon_tel" alt="" />
                                      </span>
                                      <span v-if="item.FollowUpType=='1'&&item.NeedFollowUp=='1'">
                                        <img class="img-follow" :src="icon_talk" alt="" />
                                      </span>
                                    </span>
                                    <!---->
                                    <el-dropdown-menu slot="dropdown">
                                        <el-dropdown-item command="2">删除事项</el-dropdown-item>
                                        <el-dropdown-item command="3">更多操作></el-dropdown-item>
                                    </el-dropdown-menu>
                                </el-dropdown>
                            </li>
                        </ul>
                        <div v-if="scope.row.one.things.length==0" @click="getItem(scope.row.one)">
                            <i class="el-icon-plus" @click="handleCommand('2')" ></i>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="two" :label="tableList.two" align="center" min-width="150">
                    <template slot-scope="scope" v-if="scope.row.two">
                        <div class="scopeDrop" @click="getItem(scope.row.two)">
                            <el-dropdown  trigger="click" @command="handleCommand" >
                            <span class="el-dropdown-link" >
                            {{scope.row.two.ScheduleDate}}<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                                <el-dropdown-menu slot="dropdown">
                                    <el-dropdown-item command="1">调整日期</el-dropdown-item>
                                    <el-dropdown-item command="2">添加事项</el-dropdown-item>
                                    <el-dropdown-item command="3">全部完成</el-dropdown-item>
                                </el-dropdown-menu>
                            </el-dropdown>
                        </div>
                        <ul class="scopeUl">
                            <li v-for="(item,opi) in scope.row.two.things" :key="opi"  @click="getDetails(item)">
                                <el-dropdown trigger="click"  @command="handleCommandSP">
                                  <span class="el-dropdown-link">
                                    <span class="span-radio" :style="{background:item.Color}"></span>
                                      <i v-if="item.State==1" :class="{iconOnes:item.State==1}" style="color: #4BCD61" class="el-icon-success color-check"></i>
                                      <i v-else-if="item.State==0" style="color: #DDDDDF" class="el-icon-remove-outline color-check"></i>
                                      <i v-else-if="item.State==3" class="el-icon-error" style="color:red"></i>
                                      <i v-else-if="item.State==2" class="el-icon-warning" style="color:#FF9900"></i>
                                      <i v-else class="el-icon-remove-outline" style="color: #DDDDDF"></i>
                                      <span :class="{iconOne:item.AppointState==0 ||item.AppointState==undefined,iconTwo:item.AppointState==1,iconThr:item.AppointState==2}">{{item.ScheduleName}}</span>
                                      <span v-if="item.FollowUpType=='2'&&item.NeedFollowUp=='1'">
                                          <img class="img-follow" :src="icon_tel" alt="" /></span>
                                      <span v-if="item.FollowUpType=='1'&&item.NeedFollowUp=='1'">
                                          <img class="img-follow" :src="icon_talk" alt="" />
                                      </span>
                                  </span>
                                    <el-dropdown-menu slot="dropdown">
                                        <!--<el-dropdown-item command="1">调整日期</el-dropdown-item>-->
                                        <el-dropdown-item command="2">删除事项</el-dropdown-item>
                                        <el-dropdown-item command="3">更多操作></el-dropdown-item>
                                    </el-dropdown-menu>
                                </el-dropdown>
                            </li>
                        </ul>
                        <div v-if="scope.row.two.things.length==0" @click="getItem(scope.row.two)">
                            <i class="el-icon-plus" @click="handleCommand('2')" ></i>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="three" :label="tableList.three" align="center" min-width="150">
                    <template slot-scope="scope" v-if="scope.row.three">
                        <div class="scopeDrop" @click="getItem(scope.row.three)">
                            <el-dropdown  trigger="click" @command="handleCommand" >
                            <span class="el-dropdown-link" >
                            {{scope.row.three.ScheduleDate}}<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                                <el-dropdown-menu slot="dropdown">
                                    <el-dropdown-item command="1">调整日期</el-dropdown-item>
                                    <el-dropdown-item command="2">添加事项</el-dropdown-item>
                                    <el-dropdown-item command="3">全部完成</el-dropdown-item>
                                </el-dropdown-menu>
                            </el-dropdown>
                        </div>
                        <ul class="scopeUl">
                            <li v-for="(item,opo) in scope.row.three.things" :key="opo" @click="getDetails(item)">
                                <el-dropdown trigger="click"  @command="handleCommandSP">
                                  <span class="el-dropdown-link">
                                    <span class="span-radio" :style="{background:item.Color}"></span>
                                      <i v-if="item.State==1" :class="{iconOnes:item.State==1}" style="color: #4BCD61" class="el-icon-success color-check"></i>
                                      <i v-else-if="item.State==0" style="color: #DDDDDF" class="el-icon-remove-outline color-check"></i>
                                      <i v-else-if="item.State==3" class="el-icon-error" style="color:red"></i>
                                      <i v-else-if="item.State==2" class="el-icon-warning" style="color:#FF9900"></i>
                                      <i v-else class="el-icon-remove-outline" style="color: #DDDDDF"></i>
                                      <span :class="{iconOne:item.AppointState==0 ||item.AppointState==undefined,iconTwo:item.AppointState==1,iconThr:item.AppointState==2}">{{item.ScheduleName}}</span>
                                      <span v-if="item.FollowUpType=='2'&&item.NeedFollowUp=='1'">
                                          <img class="img-follow" :src="icon_tel" alt="" />
                                      </span><span v-if="item.FollowUpType=='1'&&item.NeedFollowUp=='1'">
                                      <img class="img-follow" :src="icon_talk" alt="" />
                                  </span>
                                  </span>
                                    <el-dropdown-menu slot="dropdown">
                                        <!--<el-dropdown-item command="1">调整日期</el-dropdown-item>-->
                                        <el-dropdown-item command="2">删除事项</el-dropdown-item>
                                        <el-dropdown-item command="3">更多操作></el-dropdown-item>
                                    </el-dropdown-menu>
                                </el-dropdown>
                            </li>
                        </ul>
                        <div v-if="scope.row.three.things.length==0" @click="getItem(scope.row.three)">
                            <i class="el-icon-plus" @click="handleCommand('2')" ></i>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="four" :label="tableList.four" align="center" min-width="150">
                    <template slot-scope="scope" v-if="scope.row.four">
                        <div class="scopeDrop" @click="getItem(scope.row.four)">
                            <el-dropdown  trigger="click" @command="handleCommand" >
                            <span class="el-dropdown-link" >
                            {{scope.row.four.ScheduleDate}}<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                                <el-dropdown-menu slot="dropdown">
                                    <el-dropdown-item command="1">调整日期</el-dropdown-item>
                                    <el-dropdown-item command="2">添加事项</el-dropdown-item>
                                    <el-dropdown-item command="3">全部完成</el-dropdown-item>
                                </el-dropdown-menu>
                            </el-dropdown>
                        </div>
                        <ul class="scopeUl">
                            <li v-for="(item,opl) in scope.row.four.things" :key="opl" @click="getDetails(item)">
                                <el-dropdown trigger="click"  @command="handleCommandSP">
                                 <span class="el-dropdown-link">
                                    <span class="span-radio" :style="{background:item.Color}"></span>
                                     <i v-if="item.State==1" :class="{iconOnes:item.State==1}" style="color: #4BCD61" class="el-icon-success color-check"></i>
                                     <i v-else-if="item.State==0" style="color: #DDDDDF" class="el-icon-remove-outline color-check"></i>
                                     <i v-else-if="item.State==3" class="el-icon-error" style="color:red"></i>
                                     <i v-else-if="item.State==2" class="el-icon-warning" style="color:#FF9900"></i>
                                     <i v-else class="el-icon-remove-outline" style="color: #DDDDDF"></i>
                                     <span :class="{iconOne:item.AppointState==0 ||item.AppointState==undefined,iconTwo:item.AppointState==1,iconThr:item.AppointState==2}">{{item.ScheduleName}}</span>
                                     <span v-if="item.FollowUpType=='2'&&item.NeedFollowUp=='1'"> <img class="img-follow" :src="icon_tel" alt="" /></span>
                                     <span v-if="item.FollowUpType=='1'&&item.NeedFollowUp=='1'"> <img class="img-follow" :src="icon_talk" alt="" /></span>
                                  </span>
                                    <el-dropdown-menu slot="dropdown">
                                        <!--<el-dropdown-item command="1">调整日期</el-dropdown-item>-->
                                        <el-dropdown-item command="2">删除事项</el-dropdown-item>
                                        <el-dropdown-item command="3">更多操作></el-dropdown-item>
                                    </el-dropdown-menu>
                                </el-dropdown>
                            </li>
                        </ul>
                        <div v-if="scope.row.four.things.length==0" @click="getItem(scope.row.four)">
                            <i class="el-icon-plus" @click="handleCommand('2')" ></i>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="five" :label="tableList.five" align="center" min-width="150">
                    <template slot-scope="scope" v-if="scope.row.five">
                        <div class="scopeDrop" @click="getItem(scope.row.five)">
                            <el-dropdown  trigger="click" @command="handleCommand" >
                            <span class="el-dropdown-link" >
                            {{scope.row.five.ScheduleDate}}<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                                <el-dropdown-menu slot="dropdown">
                                    <el-dropdown-item command="1">调整日期</el-dropdown-item>
                                    <el-dropdown-item command="2">添加事项</el-dropdown-item>
                                    <el-dropdown-item command="3">全部完成</el-dropdown-item>
                                </el-dropdown-menu>
                            </el-dropdown>
                        </div>
                        <ul class="scopeUl">
                            <li v-for="(item,ops) in scope.row.five.things" :key="ops" @click="getDetails(item)">
                                <el-dropdown trigger="click"  @command="handleCommandSP">
                                  <span class="el-dropdown-link">
                                    <span class="span-radio" :style="{background:item.Color}"></span>
                                      <i v-if="item.State==1" :class="{iconOnes:item.State==1}" style="color: #4BCD61" class="el-icon-success color-check"></i>
                                      <i v-else-if="item.State==0" style="color: #DDDDDF" class="el-icon-remove-outline color-check"></i>
                                      <i v-else-if="item.State==3" class="el-icon-error" style="color:red"></i>
                                      <i v-else-if="item.State==2" class="el-icon-warning" style="color:#FF9900"></i>
                                      <i v-else class="el-icon-remove-outline" style="color: #DDDDDF"></i>
                                      <span :class="{iconOne:item.AppointState==0 ||item.AppointState==undefined,iconTwo:item.AppointState==1,iconThr:item.AppointState==2}">{{item.ScheduleName}}</span>
                                      <span v-if="item.FollowUpType=='2'&&item.NeedFollowUp=='1'">
                                          <img class="img-follow" :src="icon_tel" alt="" /></span>
                                      <span v-if="item.FollowUpType=='1'&&item.NeedFollowUp=='1'">
                                          <img class="img-follow" :src="icon_talk" alt="" />
                                      </span>
                                  </span>
                                    <el-dropdown-menu slot="dropdown">
                                        <!--<el-dropdown-item command="1">调整日期</el-dropdown-item>-->
                                        <el-dropdown-item command="2">删除事项</el-dropdown-item>
                                        <el-dropdown-item command="3">更多操作></el-dropdown-item>
                                    </el-dropdown-menu>
                                </el-dropdown>
                            </li>
                        </ul>
                        <div v-if="scope.row.five.things.length==0" @click="getItem(scope.row.five)">
                            <i class="el-icon-plus" @click="handleCommand('2')" ></i>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="six" :label="tableList.six" align="center" min-width="150">
                    <template slot-scope="scope" v-if="scope.row.six">
                        <div class="scopeDrop" @click="getItem(scope.row.six)">
                            <el-dropdown  trigger="click" @command="handleCommand" >
                            <span class="el-dropdown-link" >
                            {{scope.row.six.ScheduleDate}}<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                                <el-dropdown-menu slot="dropdown">
                                    <el-dropdown-item command="1">调整日期</el-dropdown-item>
                                    <el-dropdown-item command="2">添加事项</el-dropdown-item>
                                    <el-dropdown-item command="3">全部完成</el-dropdown-item>
                                </el-dropdown-menu>
                            </el-dropdown>
                        </div>
                        <ul class="scopeUl">
                            <li v-for="(item,op) in scope.row.six.things" :key="op" @click="getDetails(item)">
                                <el-dropdown trigger="click"  @command="handleCommandSP">
                                 <span class="el-dropdown-link">
                                    <span class="span-radio" :style="{background:item.Color}"></span>
                                     <i v-if="item.State==1" :class="{iconOnes:item.State==1}" style="color: #4BCD61" class="el-icon-success color-check"></i>
                                     <i v-else-if="item.State==0" style="color: #DDDDDF" class="el-icon-remove-outline color-check"></i>
                                     <i v-else-if="item.State==3" class="el-icon-error" style="color:red"></i>
                                     <i v-else-if="item.State==2" class="el-icon-warning" style="color:#FF9900"></i>
                                     <i v-else class="el-icon-remove-outline" style="color: #DDDDDF"></i>
                                     <span :class="{iconOne:item.AppointState==0 ||item.AppointState==undefined,iconTwo:item.AppointState==1,iconThr:item.AppointState==2}">{{item.ScheduleName}}</span>
                                     <span v-if="item.FollowUpType=='2'&&item.NeedFollowUp=='1'"> <img class="img-follow" :src="icon_tel" alt="" /></span>
                                     <span v-if="item.FollowUpType=='1'&&item.NeedFollowUp=='1'"> <img class="img-follow" :src="icon_talk" alt="" /></span>
                                  </span>
                                    <el-dropdown-menu slot="dropdown">
                                        <!--<el-dropdown-item command="1">调整日期</el-dropdown-item>-->
                                        <el-dropdown-item command="2">删除事项</el-dropdown-item>
                                        <el-dropdown-item command="3">更多操作></el-dropdown-item>
                                    </el-dropdown-menu>
                                </el-dropdown>
                            </li>
                        </ul>
                        <div v-if="scope.row.six.things.length==0" @click="getItem(scope.row.six)">
                            <i class="el-icon-plus" @click="handleCommand('2')" ></i>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="seven" :label="tableList.seven" align="center" min-width="150">
                    <template slot-scope="scope" v-if="scope.row.seven">
                        <div class="scopeDrop" @click="getItem(scope.row.seven)">
                            <el-dropdown  trigger="click" @command="handleCommand" >
                            <span class="el-dropdown-link" >
                            {{scope.row.seven.ScheduleDate}}<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                                <el-dropdown-menu slot="dropdown">
                                    <el-dropdown-item command="1">调整日期</el-dropdown-item>
                                    <el-dropdown-item command="2">添加事项</el-dropdown-item>
                                    <el-dropdown-item command="3">全部完成</el-dropdown-item>
                                </el-dropdown-menu>
                            </el-dropdown>
                        </div>
                        <ul class="scopeUl">
                            <li v-for="(item,ts) in scope.row.seven.things" :key="ts" @click="getDetails(item)">
                                <el-dropdown trigger="click"  @command="handleCommandSP">
                                 <span class="el-dropdown-link">
                                    <span class="span-radio" :style="{background:item.Color}"></span>
                                     <i v-if="item.State==1" :class="{iconOnes:item.State==1}" style="color: #4BCD61" class="el-icon-success color-check"></i>
                                     <i v-else-if="item.State==0" style="color: #DDDDDF" class="el-icon-remove-outline color-check"></i>
                                     <i v-else-if="item.State==3" class="el-icon-error" style="color:red"></i>
                                     <i v-else-if="item.State==2" class="el-icon-warning" style="color:#FF9900"></i>
                                     <i v-else class="el-icon-remove-outline" style="color: #DDDDDF"></i>
                                     <span :class="{iconOne:item.AppointState==0 ||item.AppointState==undefined,iconTwo:item.AppointState==1,iconThr:item.AppointState==2}">{{item.ScheduleName}}</span>
                                     <span v-if="item.FollowUpType=='2'&&item.NeedFollowUp=='1'">
                                         <img class="img-follow" :src="icon_tel" alt="" />
                                     </span>
                                     <span v-if="item.FollowUpType=='1'&&item.NeedFollowUp=='1'">
                                         <img class="img-follow" :src="icon_talk" alt="" />
                                     </span>
                                  </span>
                                    <el-dropdown-menu slot="dropdown">
                                        <!--<el-dropdown-item command="1">调整日期</el-dropdown-item>-->
                                        <el-dropdown-item command="2">删除事项</el-dropdown-item>
                                        <el-dropdown-item command="3">更多操作></el-dropdown-item>
                                    </el-dropdown-menu>
                                </el-dropdown>
                            </li>
                        </ul>
                        <div v-if="scope.row.seven.things.length==0" @click="getItem(scope.row.seven)">
                            <i class="el-icon-plus" @click="handleCommand('2')" ></i>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
        </template>
        <el-dialog
                title="提示"
                :visible.sync="centerDialogVisible"
                :close-on-click-modal="false"
                width="30%"
                center>
                <el-date-picker
                        v-model="Datevalue"
                        type="date"
                        value-format="yyyy-MM-dd"
                        @change="changeDate"
                        placeholder="选择日期">
                </el-date-picker>
                <span slot="footer" class="dialog-footer">
                <el-button @click="centerDialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="sureTime">确 定</el-button>
              </span>
        </el-dialog>
        <el-dialog
                title="查看访谈人员安排"
                :visible.sync="jkftDialog"
                :close-on-click-modal="false"
                width="80%">
                <el-table
                    :data="jkftDialogtableData"
                    border
                    element-loading-text="加载中"
                    style="width: 100%">
                    <el-table-column
                        prop="Nurse"
                        header-align="center"
                        align="center"
                        label="访谈人员"
                        min-width="100"
                    ></el-table-column>
                    <el-table-column
                        prop="VisitTime"
                        header-align="center"
                        align="center"
                        label="安排事项"
                        min-width="400"
                    ></el-table-column>
                </el-table>
                <span slot="footer" class="dialog-footer">
                <el-button @click="jkftDialog = false">关 闭</el-button>
              </span>
        </el-dialog>
        <!-- 编辑查看对话框 -->
        <el-dialog title="添加事项" :visible.sync="swDialogVisible" :append-to-body="true" top="0" width="60%" :close-on-click-modal="false">
            <div class="" style="width:100%">
                <span style="display:inline;width:90px;height:50px;line-height:40px;padding-right:20px;">事项类型</span>
                <el-select v-model="searchData.type" placeholder="请选择"   style="margin-right:30px;width:150px">
                    <el-option label="全部" value=""></el-option>
                    <el-option label="健康访谈" value="1"></el-option>
                    <el-option label="营养门诊" value="2"></el-option>
                    <el-option label="健康教育" value="3"></el-option>
                    <el-option label="母乳喂养随访" value="5"></el-option>
                    <el-option label="数据采集" value="6"></el-option>
                    <el-option label="肥胖门诊" value="7"></el-option>
                    <el-option label="其它事项" value="4"></el-option>
                </el-select>
                <el-input v-model="keyword" placeholder="待办事项标题关键字" class="header-query" style="margin-right:30px;width:180px"></el-input>
                <el-button type="primary"    @click="queryHandler">查询</el-button>
            </div>
            <el-table :data="tableDatasp" @select="handleSelect" @select-all="handleSelect" ref="multipleTable" border empty-text="当前列表为空"   element-loading-text="拼命加载中" style="width: 100%;margin-top:20px;">
                <el-table-column type="selection" width="55" :selectable="checkSelectable">
                </el-table-column>
                <el-table-column header-align="center" prop="Title" label="待办事项标题" min-width="300">
                </el-table-column>

                <el-table-column align="center" :formatter="Fllowformater" prop="NeedFollowUp" label="事项类型"
                                 min-width="80">
                </el-table-column>

                <el-table-column align="center" :formatter="FollowUpTypeFormater" prop="FollowUpType" label="访谈类型" min-width="90">
                </el-table-column>

                <el-table-column align="center" :formatter="TFformater" prop="NeedQuestionnaire" label="填写问卷" min-width="80">
                </el-table-column>

                <el-table-column align="center" prop="Description" label="具体描述" min-width="100">
                </el-table-column>
                <el-table-column align="center" prop="IsTemplate" :formatter="IsTemplateformater" label="模板事项" min-width="80">
                </el-table-column>
            </el-table>
            <!--分页-->
            <div class="block mg-20-auto">
                <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="pageCount" :page-sizes="[5, 10, 20, 30]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
                </el-pagination>
            </div>
             <span slot="footer" class="dialog-footer">
                <el-button @click="swDialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="saveHandler">确认添加</el-button>
             </span>
        </el-dialog>
        <!--更多操作-->
        <el-dialog
                title="更多操作"
                :visible.sync="MoreDialogVisible"
                :close-on-click-modal="false"
                width="60%"
                :append-to-body="true"
                :top="parseInt(addForm1.NeedFollowUp) <= 7 && parseInt(addForm1.NeedFollowUp)!=4  ? '0' :'15vh'"
                >
            <div>
                <div class="headerTop_ukl" style="width: auto;min-width: auto">
                    <ul class="clearfix">
                        <li>
                            <p class="p1"><img src="../../assets/images/icon_yanjiuduixiang.png" alt=""/><span>研究对象</span></p>
                            <p class="p3">{{userBasic.Surname}}({{userBasic.ResearchNo}})</p>
                        </li>
                        <li style="width: 100px">
                            <p class="p1"><img src="../../assets/images/icon_ganyuzu.png" alt=""/>{{userBasic.GroupType |GroupType}}</p>
                            <p  class="p3" v-if="userBasic.Period!='3'"><span v-if="userBasic.GroupType==1">{{userBasic.IntensityOfIntervention |IntensityOfIntervention}}</span></p>
                            <p  class="p3" v-else>
                                <span v-if="userBasic.GroupType==1">
                                    {{userBasic.ChildIntensityOfIntervention |IntensityOfIntervention}}
                                </span>
                            </p>
                        </li>
                        <li style="width: 300px">
                            <p class="p1"><img src="../../assets/images/icon_huaiyunqi.png" alt=""/>{{userBasic.Period |Period}}</p>
                            <p  class="p3"><span v-if="userBasic.Period==2">预产期：{{userBasic.ExpectedDate}},孕{{yunzhou}}周+{{yuntianshu}}</span></p>
                        </li>
                    </ul>
                </div>
            <el-form :model="addForm1" :rules="rules1" ref="addForm1" label-width="140px" class="demo-ruleForm">
                <!--我的随访-->
                <div v-if="addForm1.NeedFollowUp==1">
                    <el-form-item label="访谈日期" prop="FollowUpDate">
                        <el-date-picker
                                style="width:auto"
                                v-model="addForm1.FollowUpDate"
                                type="date"
                                :editable="false"
                                :clearable="false"
                                @change="changeDateFllow(addForm1.FollowUpDate,'FollowUpDate')"
                                value-format="yyyy-MM-dd"
                                placeholder="选择日期">
                        </el-date-picker>
                        <span @click="watchFtlist" style="margin-left:30px;color:#409EFF;cursor:pointer">查询当日访谈人员安排</span>
                    </el-form-item>
                    <el-form-item label="" style="height: auto;margin-bottom: 0;margin-top: -17px;">
                        <p style="color: #999999">对象当日安排:{{GetMyScheduleTime}}</p>
                    </el-form-item>
                    <el-form-item label="访谈人员" prop="FollowUpNurse">
                        <el-select v-model="addForm1.FollowUpNurse" placeholder="请选择" @change="changeNurse(addForm1.FollowUpNurse,'FollowUpNurseId','FollowUpDate','optionsNurse')">
                            <el-option
                                    v-for="item in optionsNurse"
                                    :key="item.NurseId"
                                    :label="item.icons"
                                    :value="item.icons">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="" style="height: auto;margin-bottom: 0;margin-top: -17px;">
                        <p style="color: #999999">人员当日安排:{{GetAppointTimes}}</p>
                    </el-form-item>
                    <el-form-item label="访谈时间">
                        <el-time-select
                                @change="changeFollowUpTime"
                                v-model="addForm1.FollowUpTime"
                                :picker-options="{start: '08:00', step: '00:15',end: '21:30'}"
                                placeholder="选择时间">
                        </el-time-select>
                    </el-form-item>
                    <el-form-item label="计划访谈类型" >
                        <p>{{addForm1.FollowUpType | FollowUpTypeFilter}}</p>
                        <!-- <el-select v-model="addForm1.FollowUpType" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options1"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select> -->
                    </el-form-item>
                    <el-form-item label="实际访谈类型" prop="ActualFollowUpType">
                        <el-select v-model="addForm1.ActualFollowUpType" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options1"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="预约状态" prop="FollowUpAppointState">
                        <el-select v-model="addForm1.FollowUpAppointState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options2"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="事项状态">
                        <el-select @change="changeFollowUpState" v-model="addForm1.FollowUpState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options3s"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="事项备注">
                        <el-input  v-model="addForm1.FollowUpRemark" placeholder=""></el-input>
                    </el-form-item>
                    <el-form-item label="事项取消原因">
                         <el-select :disabled="addForm1.FollowUpState!=='2'"  v-model="addForm1.FollowUpCancleReason"  placeholder="请选择">
                            <el-option value="研究对象没有来" label="研究对象没有来"></el-option>
                            <el-option value="访谈人员没有时间" label="访谈人员没有时间"></el-option>
                            <el-option value="其他" label="其他"></el-option>
                        </el-select>
                    </el-form-item>
                     <el-form-item label="具体原因">
                        <el-input :disabled="addForm1.FollowUpState!=='2'"  v-model="addForm1.FollowUpCancleReasonDetail" placeholder=""></el-input>
                    </el-form-item>
                </div>
                <!--营养门诊-->
                <div v-else-if="addForm1.NeedFollowUp==2">
                    <el-form-item label="就诊日期" prop="VisitDate">
                        <el-date-picker
                                v-model="addForm1.VisitDate"
                                :clearable="false"
                                :editable="false"
                                type="date"
                                value-format="yyyy-MM-dd"
                                @change="changeDateFllow(addForm1.VisitDate,'VisitDate')"
                                placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="" style="height: auto;margin-bottom: 0;margin-top: -17px;">
                        <p style="color: #999999">对象当日安排:{{GetMyScheduleTime}}</p>
                    </el-form-item>
                    <el-form-item label="营养师">
                        <el-select v-model="addForm1.NutritionServiceNurse" placeholder="请选择"  @change="changeNurse(addForm1.NutritionServiceNurse,'NutritionServiceNurseId','VisitDate','optionsYingy')">
                            <el-option
                                    v-for="item in optionsYingy"
                                    :key="item.SYS_ID"
                                    :label="item.icons"
                                    :value="item.icons">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="" style="height: auto;margin-bottom: 0;margin-top: -17px;">
                        <p style="color: #999999">当日营养师安排:{{GetAppointTimes}}</p>
                    </el-form-item>
                    <el-form-item label="就诊时间">
                        <el-time-select
                                v-model="addForm1.VisitTime"
                                :picker-options="{start: '08:00', step: '00:15',end: '21:30'}"
                                placeholder="选择时间">
                        </el-time-select>
                    </el-form-item>

                    <el-form-item label="预约状态">
                        <el-select v-model="addForm1.NutritionServiceAppointState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options2"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="事项状态">
                        <el-select v-model="addForm1.NutritionServiceState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options3s"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="事项备注">
                        <el-input  v-model="addForm1.NutritionServiceRemark" placeholder=""></el-input>
                    </el-form-item>
                    <el-form-item label="事项取消原因">
                        <el-input :disabled="addForm1.NutritionServiceState!=='2'"  v-model="addForm1.NutritionServiceCancleReason" placeholder=""></el-input>
                    </el-form-item>
                </div>
                <!--健康教育-->
                <div v-else-if="addForm1.NeedFollowUp==3">
                    <el-form-item label="上课日期" prop="LessonDate">
                        <el-date-picker
                                v-model="addForm1.LessonDate"
                                :clearable="false"
                                type="date"
                                :editable="false"
                                @change="changeDateFllow(addForm1.LessonDate,'LessonDate')"
                                value-format="yyyy-MM-dd"
                                placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="" style="height: auto;margin-bottom: 0;margin-top: -17px;">
                        <p style="color: #999999">对象当日安排:{{GetMyScheduleTime}}</p>
                    </el-form-item>
                    <el-form-item label="上课时间">
                        <el-time-select
                                v-model="addForm1.LessonTime"
                                :picker-options="{start: '08:00', step: '00:15',end: '21:30'}"
                                placeholder="选择时间">
                        </el-time-select>
                    </el-form-item>
                    <el-form-item label="事项标题">
                        <el-input v-model="addForm1.LessonName" :disabled="true">
                        </el-input>
                    </el-form-item>
                    <el-form-item label="预约状态">
                        <el-select v-model="addForm1.LessonAppointState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options2"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="事项状态">
                        <el-select v-model="addForm1.LessonState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options3s"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="事项备注">
                        <el-input  v-model="addForm1.LessonRemark" placeholder=""></el-input>
                    </el-form-item>
                    <el-form-item label="事项取消原因">
                        <el-input :disabled="addForm1.LessonState!=='2'"  v-model="addForm1.LessonCancleReason" placeholder=""></el-input>
                    </el-form-item>
                </div>
                <!--哺乳喂养-->
                <div v-else-if="addForm1.NeedFollowUp==5">
                    <el-form-item label="访谈日期" prop="BreastFollowUpDate">
                        <el-date-picker
                                v-model="addForm1.BreastFollowUpDate"
                                :clearable="false"
                                :editable="false"
                                type="date"
                                value-format="yyyy-MM-dd"
                                @change="changeDateFllow(addForm1.BreastFollowUpDate,'BreastFollowUpDate')"
                                placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="" style="height: auto;margin-bottom: 0;margin-top: -17px;">
                        <p style="color: #999999">对象当日安排:{{GetMyScheduleTime}}</p>
                    </el-form-item>
                    <el-form-item label="访谈人员">
                        <el-select v-model="addForm1.BreastFollowUpNurse" placeholder="请选择"  @change="changeNurse(addForm1.BreastFollowUpNurse,'BreastFollowUpNurseId','BreastFollowUpDate','optionsBr')">
                            <el-option
                                    v-for="item in optionsBr"
                                    :key="item.NurseId"
                                    :label="item.icons"
                                    :value="item.icons">
                            </el-option>
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="" style="height: auto;margin-bottom: 0;margin-top: -17px;">
                        <p style="color: #999999">访谈人员当日安排:{{GetAppointTimes}}</p>
                    </el-form-item>
                    <el-form-item label="访谈时间">
                        <el-time-select
                                v-model="addForm1.BreastFollowUpTime"
                                :picker-options="{start: '08:00', step: '00:15',end: '21:30'}"
                                placeholder="选择时间">
                        </el-time-select>
                    </el-form-item>
                    <el-form-item label="访谈类型" >
                        <el-select v-model="addForm1.BreastFollowUpType" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options1"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="预约状态">
                        <el-select v-model="addForm1.BreastFollowUpAppointState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options2"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="事项状态">
                        <el-select  v-model="addForm1.BreastFollowUpState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options3s"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="事项备注">
                        <el-input  v-model="addForm1.BreastFollowUpRemark" placeholder=""></el-input>
                    </el-form-item>
                    <el-form-item label="事项取消原因">
                        <el-input :disabled="addForm1.BreastFollowUpState!=='2'"  v-model="addForm1.BreastFollowUpCancleReason" placeholder=""></el-input>
                    </el-form-item>
                </div>
                <!--数据采集-->
                <div v-else-if="addForm1.NeedFollowUp==6">
                    <el-form-item label="预约日期" prop="DataCollectionAppointDate">
                        <el-date-picker
                                v-model="addForm1.DataCollectionAppointDate"
                                type="date"
                                :editable="false"
                                :clearable="false"
                                @change="changeDateFllow(addForm1.DataCollectionAppointDate,'DataCollectionAppointDate')"
                                value-format="yyyy-MM-dd"
                                placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="" style="height: auto;margin-bottom: 0;margin-top: -17px;">
                        <p style="color: #999999">对象当日安排:{{GetMyScheduleTime}}</p>
                    </el-form-item>
                    <el-form-item label="数据采集员">
                        <el-select v-model="addForm1.DataCollectionNurse" placeholder="请选择" @change="changeNurse(addForm1.DataCollectionNurse,'DataCollectionNurseId','DataCollectionAppointDate','optionsShuju')">
                            <el-option
                                    v-for="item in optionsShuju"
                                    :key="item.NurseId"
                                    :label="item.icons"
                                    :value="item.icons">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="" style="height: auto;margin-bottom: 0;margin-top: -17px;">
                        <p style="color: #999999">人员当日安排:{{GetAppointTimes}}</p>
                    </el-form-item>
                    <el-form-item label="预约时间">
                        <el-time-select
                                v-model="addForm1.DataCollectionAppointTime"
                                :picker-options="{start: '08:00', step: '00:15',end: '21:30'}"
                                placeholder="选择时间">
                        </el-time-select>
                    </el-form-item>
                    <el-form-item label="预约状态">
                        <el-select v-model="addForm1.DataCollectionAppointState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options2"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="事项状态">
                        <el-select v-model="addForm1.DataCollectionItemState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options3s"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="事项备注">
                        <el-input  v-model="addForm1.DataCollectionRemark" placeholder=""></el-input>
                    </el-form-item>
                    <el-form-item label="事项取消原因">
                        <el-input :disabled="addForm1.DataCollectionAppointState!=='2'"  v-model="addForm1.DataCollectionCancleReason" placeholder=""></el-input>
                    </el-form-item>
                </div>
                <!--肥胖门诊-->
                <div v-else-if="addForm1.NeedFollowUp==7">
                    <el-form-item label="就诊日期" prop="FatOutpatientAppointDate">
                        <el-date-picker
                                v-model="addForm1.FatOutpatientAppointDate"
                                :clearable="false"
                                :editable="false"
                                type="date"
                                value-format="yyyy-MM-dd"
                                @change="changeDateFllow(addForm1.FatOutpatientAppointDate,'FatOutpatientAppointDate')"
                                placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="" style="height: auto;margin-bottom: 0;margin-top: -17px;">
                        <p style="color: #999999">对象当日安排:{{GetMyScheduleTime}}</p>
                    </el-form-item>
                    <el-form-item label="儿科医生">
                        <el-select v-model="addForm1.PediatricianName" placeholder="请选择"  @change="changeNurse(addForm1.PediatricianName,'PediatricianId','FatOutpatientAppointDate','optionChilddoc')">
                            <el-option
                                    v-for="item in optionChilddoc"
                                    :key="item.SYS_ID"
                                    :label="item.icons"
                                    :value="item.icons">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="" style="height: auto;margin-bottom: 0;margin-top: -17px;">
                        <p style="color: #999999">儿科医生当日安排:{{GetChildoctTimes}}</p>
                    </el-form-item>
                    <el-form-item label="营养师">
                        <el-select v-model="addForm1.DietitianName" placeholder="请选择"  @change="changeNurse(addForm1.DietitianName,'PediatricianId','FatOutpatientAppointDate','optionsYingy')">
                            <el-option
                                    v-for="item in optionsYingy"
                                    :key="item.SYS_ID"
                                    :label="item.icons"
                                    :value="item.icons">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="" style="height: auto;margin-bottom: 0;margin-top: -17px;">
                        <p style="color: #999999">当日营养师安排:{{GetAppointTimes}}</p>
                    </el-form-item>
                    <el-form-item label="就诊时间">
                        <el-time-select
                                v-model="addForm1.FatOutpatientAppointTime"
                                :picker-options="{start: '08:00', step: '00:15',end: '21:30'}"
                                placeholder="选择时间">
                        </el-time-select>
                    </el-form-item>
                    <el-form-item label="预约状态">
                        <el-select v-model="addForm1.FatOutpatientAppointState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options2"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="事项状态">
                        <el-select v-model="addForm1.FatOutpatientItemState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options3s"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="事项备注">
                        <el-input  v-model="addForm1.FatOutpatientRemark" placeholder=""></el-input>
                    </el-form-item>
                    <el-form-item label="事项取消原因">
                        <el-input :disabled="addForm1.FatOutpatientItemState!=='2'"  v-model="addForm1.FatOutpatientCancleReason" placeholder=""></el-input>
                    </el-form-item>
                </div>
                <!--其他事项-->
                <div v-else>
                    <el-form-item label="事项日期" prop="ScheduleDate">
                        <el-date-picker
                                v-model="addForm1.ScheduleDate"
                                type="date"
                                :clearable="false"
                                :editable="false"
                                @change="changeDateFllow(addForm1.ScheduleDate,'ScheduleDate')"
                                value-format="yyyy-MM-dd"
                                placeholder="选择日期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="事项状态">
                        <el-select v-model="addForm1.ScheduleState" clearable placeholder="请选择">
                            <el-option
                                    v-for="item in options3s"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="事项备注">
                        <el-input  v-model="addForm1.Remark" placeholder=""></el-input>
                    </el-form-item>
                    <el-form-item label="事项取消原因">
                        <el-input :disabled="addForm1.ScheduleState!=='2'"  v-model="addForm1.CancleReason" placeholder=""></el-input>
                    </el-form-item>
                </div>
            </el-form>
                </div>
                <span slot="footer" class="dialog-footer">
                <el-button @click="MoreDialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="MoreAction('addForm1')">确 定</el-button>
              </span>
        </el-dialog>
        <!--更多操作-->
    </div>
</template>
<script>
import {mapGetters} from 'vuex'
import {getChildAge2} from '@/utils/index'
import {filterPeriod,filterIntensityOfIntervention} from '@/utils/localDic'
export default {
    data() {
        return {
            chDate:false,
            temTops:['周次','+0','+1','+2','+3','+4','+5','+6'],
            weeks:[],
            lists:[],
            tableData:[],
            loading:true,
            itemType:'',
            maxHeight:'',
            dataFocus:'',
            sysId:'',
            total:null,
            Datevalue:'',
            swDialogVisible:false,
            tableDatasp:[],
            centerDialogVisible:false,
            defaultValue:[],
            keyword:'',
            mobile:'',
            multipleSelection:[],
            researchNo:'',
            userBasic:{
                Surname:'',
                ResearchNo:'',
                ExpectedDate:'',
                Period:'',
                IntensityOfIntervention:'',
                GroupType:'',
                SYS_ID:''
            },
            arrayYun:[],//怀孕期
            allLists:[],//点击下拉框数据集合
            onOfftime:false,
            pageSize: 5,
            pageCount: 1,
            TFformater(row, column, cellValue, index) {
                return cellValue == 1 ? "是" : "否";
            },
            IsTemplateformater(row, column, cellValue, index) {
                return cellValue == 1 ? "是" : "否";
            },
            FollowUpTypeFormater(row, column, cellValue, index) {
                return row.NeedFollowUp==1?(cellValue ? (cellValue == 1 ? "面对面" : "电话") : "-"):'-';
            },
            multipleSelection: [],
            TFwrap:{
                TimeSpan:'',
                ScheduleDate:''
            },
            tableList:{
                one:'',two:'',three:'',four:'',five:'',six:'',seven:''
            },
            listITEM:'',
            timeSps:'',
            icon_tel: require("../../../src/assets/images/icon_tel.png"),
            icon_talk: require("../../../src/assets/images/icon_talk.png"),
            animateTOP:'',  //滚动高度
            MoreDialogVisible:false,
            rules1:{
                FollowUpDate:[{trigger: 'blur', required: true,message:'必填项'}],
                FollowUpNurse:[{trigger: 'blur', required: true,message:'必填项'}],
                ActualFollowUpType:[{trigger: 'change', required: true,message:'必填项'}],
                VisitDate:[{trigger: 'blur', required: true,message:'必填项'}],
                LessonDate:[{trigger: 'blur', required: true,message:'必填项'}],
                ScheduleDate:[{trigger: 'blur', required: true,message:'必填项'}],
	            BreastFollowUpDate:[{trigger: 'blur', required: true,message:'必填项'}],
                DataCollectionAppointDate:[{trigger: 'blur', required: true,message:'必填项'}],
                FollowUpAppointState:[{trigger: 'blur', required: true,message:'必填项'}],
            },
            addForm1:{},
            options1:[{value: '1', label: '面对面'}, {value: '2', label: '电话'}, {value: '3', label: '微信视频'}],
            options2: [{value: '0', label: '待确认'},{value: '1', label: '已确认'}, {value: '2', label: '已取消'}],
            options8: [{value: '0', label: '孕期营养必修课'},{value: '1', label: '一起来运动吧'}, {value: '2', label: '烹饪课'}, {value: '3', label: '月子里怎么吃才好'}, {value: '4', label: '母乳喂养妈妈会'}],
            options3s: [ {value: '0', label: '待完成'},{value: '1', label: '已完成'},{value: '2', label: '已取消'},{value: '3', label: '爽约'}],
            optionsNurse:[],
	        optionsShuju:[],//数据采集员
            optionsYingy:[],
	        optionChilddoc:[], // 儿科医生
            Fllowformater(row, column, cellValue, index){
                switch(cellValue){
                    case '1':
                        return '健康访谈';
                    case '2':
                        return '营养门诊';
                    case '3':
                        return '健康教育';
	                case '5':
		                return '母乳喂养随访';
	                case '6':
		                return '数据采集';
	                case '7':
		                return '肥胖门诊';
                    default:
                        return '其他事项'
                }
            },
            GetAppointTimes:'',  //已预约时间
            GetMyScheduleTime:'',//对象当日安排时间
            emptyText:'暂无日程',
            jkftDialog:false,
            jkftDialogtableData:[],
            dropIndex:'',
            searchData:{
                type:''
            },
	        GetChildoctTimes:''//儿科医生
        }
    },
    props:{
        changeIndex:{
            type: String,
        }
    },
    components:{

    },
    computed:{
        ...mapGetters([
                'resechObj',
                'RoleGroup',
                'token',
                'UserDic'
            ]),
        LASTTIME:function(){
            let dateAlary=new Date(this.userBasic.ExpectedDate)
            return new Date(dateForm(dateAlary.setMonth(dateAlary.getMonth()-9,dateAlary.getDate()-7)))
        },
        yunzhou:function(){
            return parseInt((WeeksBetw(new Date,this.LASTTIME))/7)
        },
        yuntianshu:function(){
            return parseInt((WeeksBetw(new Date,this.LASTTIME))%7)
        },
        birthWeek(){
            return parseInt((WeeksBetw(new Date,new Date(this.userBasic.ChildBirthDate)))/7)    
        },
        birthDay(){
            return parseInt((WeeksBetw(new Date,new Date(this.userBasic.ChildBirthDate)))%7)
        }
    },
    watch:{
        async changeIndex(index){
            if(index=='2'){
	            await this.getList()
            }
        },
        'addForm1.NutritionServiceState':function(val){   //营养门诊
            if(val!=='2') this.addForm1.NutritionServiceCancleReason=""
        },
        'addForm1.LessonState':function(val){   //健康jiaoyu
            if(val!=='2') this.addForm1.LessonCancleReason=""
        },
        'addForm1.ScheduleState':function(val){   //其他事项
            if(val!=='2') this.addForm1.CancleReason=""
        }
    },
    beforeMount() {
        let appHeight=$(window).height();
        let autoheight=(appHeight-208)+'px'
	    this.maxHeight=autoheight
    },
    methods: {
        getChildAge2(val){ //获取儿童期2年龄
            return val && getChildAge2(val)
        },
        changeFollowUpTime(){
            this.addForm1.FollowUpAppointState = "1"
        },
        changeFollowUpState(val){
            if(val!= '2'){
                this.addForm1.FollowUpCancleReason = ""
                this.addForm1.FollowUpCancleReasonDetail = ""
            }
        },
        watchFtlist(){  //查看健康访谈人员安排
            this.jkftDialog = true
            this.service({
                url:'/ResearchObject/GetAllAppointTimes',
                method:'get',
                params:{
                    appointDate:this.addForm1.FollowUpDate
                }
            }).then(response=>{
                this.jkftDialogtableData = response.dtData
                console.log(response)
            }).catch(data=>{

            })
        },
        GetNurse(){     //便于弹框初始化优化，页面加载前加载字典集，需同时读取该护士的已预约事项，
            let that=this;
            that.service({
                url:'/Sys/GetNurse',
                method:'get',
                params:{
                    roleGroup:'5'
                }
            }).then(response=>{
                let options=response.dtData
                for(let i of options){    //处理姓名账号不一致，NaN
                i.Name=i.Name || ''
                let username=i.Surname+i.Name
                username=='undefined'?username=i.UserCode:username=username
                    i.icons=username
                }
                that.optionsYingy=options;
            }).catch(data=>{

            })
            that.service({
                url:'/Sys/GetNurseForFollowup',
                method:'get',
                params:{
	                communityId:''
                }
            }).then(response=>{
                let options=response.dtData
                for(let i of options){    //处理姓名账号不一致，NaN
                    i.Name=i.Name || ''
                    let username=i.Surname+i.Name
                    username=='undefined'?username=i.UserCode:username=username
                    i.icons=i.NurseName
                }
                that.optionsNurse=options;
            }).catch(data=>{

            })
            //哺乳喂养HCP
	        that.service({
		        url:'/Sys/GetNurseForFollowup',
		        method:'get',
		        params:{
			        communityId:JSON.parse(this.UserDic).CommunityId||''
		        }
	        }).then(response=>{
		        let options=response.dtData
		        for(let i of options){    //处理姓名账号不一致，Nan
			        i.icons=i.NurseName
		        }
		        that.optionsBr=options;
	        }).catch(data=>{

	        })
            //获取数据采集员
	        that.service({
		        url:'/Sys/GetNurse',
		        method:'get',
		        params:{
			        roleGroup:'10'
		        }
	        }).then(response=>{
		        let options=response.dtData
		        for(let i of options){    //处理姓名账号不一致，NaN
			        i.Name=i.Name || ''
			        let username=i.Surname+i.Name
			        username=='undefined'?username=i.UserCode:username=username
			        i.icons=username
		        }
		        that.optionsShuju=options;
	        }).catch(data=>{

	        })

	        //获取儿科医生
	        that.service({
		        url:'/Sys/GetNurse',
		        method:'get',
		        params:{
			        roleGroup:'11'
		        }
	        }).then(response=>{
		        let options=response.dtData
		        for(let i of options){    //处理姓名账号不一致，NaN
			        i.Name=i.Name || ''
			        let username=i.Surname+i.Name
			        username=='undefined'?username=i.UserCode:username=username
			        i.icons=username
		        }
		        that.optionChilddoc=options;
	        }).catch(data=>{

	        })
        },
        changeNurse(val,type,times,options){   //修改护士
            let that=this;
            that[options].forEach(function (item) { //绑定ID
                if(item.icons==val){
                    that.addForm1[type]=item.SYS_ID|| item.NurseId
                }
            })
            that.service({
                url:'/ResearchObject/GetAppointTimes',
                method:'get',
                params:{
                    type:type=="FollowUpNurseId"?'1':type=="BreastFollowUpNurseId"?'5':type=="NutritionServiceNurseId"?'2':type=="DataCollectionNurseId"?'6':type == "PediatricianId"?'7':'4',
                    nurseId:that.addForm1[type]||"1",
                    appointDate:that.addForm1[times]
                }
            }).then(response=>{
                that.GetAppointTimes=response.result
            }).catch(data=>{

            })
        },
        MoreAction(formName){  //更多操作
            let that=this;
            
            that.$refs[formName].validate((valid) => {
                if (valid){
                	let oldTimeSpan = that.addForm1.TimeSpan
	                let firstDate = that.tableData[0].one.ScheduleDate  //不必重新计算，直接取
	                let weeks = parseInt((WeeksBetw(that.addForm1.ScheduleDate,firstDate))/7)
                    if(new Date(that.addForm1.ScheduleDate) < new Date(firstDate)){
	                    that.$message({
		                    message:'日期超出日程范围',
		                    type:'error'
	                    })
	                    return
                    }
                    that.addForm1.Period == '2' ? weeks+=5 :weeks = weeks  //怀孕期周数 + 5
                    if(that.addForm1.Period == '2' && oldTimeSpan >41){
	                    that.addForm1.TimeSpan = oldTimeSpan
                    }
                    else{
	                    that.addForm1.TimeSpan = weeks
                    }
	                if(isNaN(weeks)){
		                that.$message({
			                message:'计算错误，请联系技术',
			                type:'error'
		                })
		                return
	                }
	                console.log(weeks)
                    that.service({
                        url:'/ResearchObject/OperateSchedule',
                        method:'post',
                        data:{
                            ...that.addForm1
                        }
                }).then(response=>{
                            that.getList()
                            that.MoreDialogVisible=false;
                            that.$message({
                                message:'保存成功',
                                type:'success'
                            })
                            setTimeout(()=>{
                                $('.el-table--scrollable-y .el-table__body-wrapper').animate({scrollTop: that.animateTOP}, 500)
                            },1000)
                        }).catch(data=>{
                            that.MoreDialogVisible=false;
                            that.getList()
                    })
                }
                else{
                    return false
                }
            })

        },
        changeDateFllow(val,name){    //弹窗选择时间控制器
            let that=this;
            let alength=that.tableData.length-1;
            let startTime=that.tableData[0].one.ScheduleDate;
            let lastTime='';
            this.dataFocus = val
            that.addForm1.NutritionServiceNurse=''
            that.addForm1.FollowUpNurse=''
            that.addForm1.NutritionServiceNurseId=''
            that.addForm1.FollowUpNurseId=''
	        that.addForm1.ScheduleDate = val
            if(that.userBasic.Period==2){
                lastTime=that.tableData[alength-4].seven.ScheduleDate;
            }
            else{
                lastTime=that.tableData[alength].seven.ScheduleDate;
            }
            if((new Date(val)< new Date(startTime)||new Date(val)>new Date(lastTime)) && ( that.dropIndex==2 &&
                that.timeSps<42)){
                that.$notify({
                    title: '警告',
                    message: '超出日程范围',
                    type: 'warning'
                });
                that.addForm1[name]=''
                return
            }
            that.service({
                url:'/ResearchObject/GetMyScheduleTime',
                method:'get',
                params:{
                    researchObjeactId:that.userBasic.SYS_ID,
                    scheduleDate:val||'1900-01-01'
                }
            }).then(response=>{
                that.GetMyScheduleTime=response.msg
            }).catch(data=>{

            })
        },
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
        removeArrayItem(array, item) {
            var index = array.indexOf(item);
            if (index > -1) {
                array.splice(index, 1);
            }

        },
     checkSelectable(row){  //需改造modules
            if(this.RoleGroup >2 && row.IsTemplate == '1'){
                return false
            }
            return true
        },
        // 处理全选
        handleSelect(selection,row) {
            if (row) {
                if (selection.indexOf(row) !== -1) {
                    
                } else {
                    this.removeArrayItem(this.multipleSelection, row);
                }
            }
            if (selection.length > 0) {
                this.multipleSelection.push.apply(this.multipleSelection, selection);
                this.multipleSelection = Array.from(new Set(this.multipleSelection));
            } else {
                this.tableDatasp.forEach(select => {
                    this.removeArrayItem(this.multipleSelection, select);
                });
            }
        },
        // 处理选中项
        handleToggleRowSelection() {
            let _this = this;
            _this.tableDatasp.forEach(select => {
                _this.multipleSelection.forEach(mul => {
                    if (select.SYS_ID == mul.SYS_ID) {
                        _this.$refs.multipleTable.toggleRowSelection(select, true);
                    }
                });
            });
        },
        queryHandler() {
            this.pageCount=1
            this.pageSize=5
            this.total=null
            this.getBacklog();
        },
       async getBacklog() {
            let that = this;
            await that.service({
                url: "Dic/GetBacklog",
                method: "get",
                params: {
                    pageCount: that.pageCount - 1,
                    pageSize: that.pageSize,
                    blackLogTitle:that.keyword,
                    type:that.searchData.type ||'',
                    roleGroup:that.RoleGroup
                }
            }).then(response => {
                that.tableDatasp = response.dtData;
                that.total = parseInt(response.dtData[0].TotalCount);
                that.$nextTick(() => {
                      that.handleToggleRowSelection();
                });
            })
            .catch(data => {
	            console.log(data+'error')
            });
        },
        resetCommand(val){ //重置日程
            let that=this;
            switch(val){
                case 'a':      //日程重置
                    that.resetShel();
                    break
                case 'b':      //孕前期
	                that.dropIndex=1
                    that.getList(1)
                    break
                case 'c':      //怀孕期
                    that.dropIndex=2
                    that.getList(2)
                    break
                case 'd':      //儿童期1
	                that.dropIndex=3
                    that.getList(3)
                    break
                case 'e':      //儿童期2
	                that.dropIndex=4
                    that.getList(4)
                    break
            }
        },
        handleSizeChange(val) {
            //条数改变
            this.pageSize = val;
            this.getBacklog();
        },
        handleCurrentChange(val) {
            //页数改变
            this.pageCount = val;
            this.getBacklog();
        },
        saveHandler() {     //点击保存
            if (this.multipleSelection.length <= 0) {
                this.$message({
                    type: 'info',
                    message: '请选择至少一项，或者取消'
                })
                return;
            }
            this.saveScheduleTemplate(this.multipleSelection);
         },
        saveScheduleTemplate(data) {  //保存日程
            let that = this;
            let dataSy=[];
            let onoff=true
            for(let i=0;i<data.length;i++){
                let obj={
                    SYS_ID:data[i].SYS_ID,
                    ResearchObjectId:that.userBasic.SYS_ID,
                    ScheduleName:data[i].Title,
                    TimeSpan:that.TFwrap.TimeSpan,
                    ScheduleDate:that.TFwrap.ScheduleDate,
                    NeedFollowUp:data[i].NeedFollowUp,
                    FollowUpType:data[i].FollowUpType,
                    NeedQuestionnaire:data[i].NeedQuestionnaire,
                    IsFontWeight:data[i].IsFontWeight,
                    Color:data[i].Color,
                    State:0,
                }
                dataSy.push(obj)
            }
            if(!onoff){
                return false
            }
            onoff=false
            that.swDialogVisible=false
            that.loading = true
            that.service({
                url: "/ResearchObject/AddSchedule",
                method: "post",
                data: {
                    confirmTime:that.userBasic.Period==1?that.userBasic.ConfirrmTime:that.userBasic.Period==2?that.userBasic.ExpectedDate:that.userBasic.ChildBirthDate,
                    period:that.dropIndex || that.userBasic.Period,
                    ListScheduleObj:dataSy
                }
                }).then(response => {
                    that.getList()
                    setTimeout(function () {
                        $('.el-table--scrollable-y .el-table__body-wrapper').animate({scrollTop: that.animateTOP}, 500)
                    },1000)
                    onoff=true
                }).catch(data => {
                	that.loading = false
                    onoff=true
            });
        },
        changeDate(val){
            let that=this;
            if(new Date(val)>= new Date(that.defaultValue[0])&&new Date(val)<= new Date(that.defaultValue[1])){
                that.onOfftime=true
            }
            else{
                that.onOfftime=false
            }
        },
        sureTime(){  //确认时间
            let that=this;
            let yunTime=false;
            if(that.dropIndex==''){
                that.dropIndex=that.userBasic.Period
            }
            if(that.dropIndex==2 && that.timeSps>41){
                yunTime=true
            }
            let isReady=that.allLists.some((value,index)=>{              //特殊情况下加确认判断
                return value.AppointState=='1' && value.State=='0' && value.NeedFollowUp!=3
            })
            if(that.onOfftime || yunTime){
	            let firstDate = that.tableData[0].one.ScheduleDate  //不必重新计算，直接取
	            let weeks = parseInt((WeeksBetw(that.Datevalue,firstDate))/7)

	            that.dropIndex==2 ? weeks=weeks+5 : that.dropIndex==4 ? weeks=weeks+156:  weeks=weeks
                if(that.timeSps>41 && that.dropIndex==2){
	                weeks = that.timeSps
                }else{
	                weeks=weeks
                }
	            console.log(weeks)
                if(isNaN(weeks)){
                	that.$message({
                        message:'计算错误，请联系技术',
                        type:'error'
                    })
                    return
                }
                if(isReady){
                    that.$confirm('日期调整后，您需要为未完成的已预约事项重新填写预约状态和预约时间', '是否继续?', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(() => {
                        for(let i of that.allLists){  //遍历State
                            i.ScheduleDate = that.Datevalue
                            i.TimeSpan = weeks
                        }
                        let dataTimes = that.userBasic.Period==1
                                ?that.userBasic.ConfirrmTime:that.userBasic.Period==2
                                ?that.userBasic.ExpectedDate:that.userBasic.ChildBirthDate;
                        that.loading = true
                        that.service({
                            url:'/ResearchObject/ChangeScheduleDate',
                            method:'post',
                            data:{
                                confirmTime:dataTimes,
                                period:that.dropIndex,
                                ListScheduleObj:that.allLists
                            }
                        }).then(response=>{
                            setTimeout(function () {
                                $('.el-table--scrollable-y .el-table__body-wrapper').animate({scrollTop: that.animateTOP}, 500)
	                            that.getList()
                            },3000)
                            that.$message({
                                type: 'success',
                                message: '修改成功!'
                            })
                            that.onOfftime=false
                        }).catch(data=>{
                        	that.loading = false
                            that.onOfftime=false
                        })
                        that.centerDialogVisible=false
                    })
                }
                else{
                    for(let i of that.allLists){  //遍历State
                        i.ScheduleDate = that.Datevalue
                        i.TimeSpan = weeks
                    }
                    if(that.dropIndex==''){
                        that.dropIndex=that.userBasic.Period
                    }
	                let dataTimes =
                        that.dropIndex==1
                            ?that.userBasic.ConfirrmTime:that.dropIndex==2
                            ?that.userBasic.ExpectedDate:that.userBasic.ChildBirthDate;
                    that.service({
                        url:'/ResearchObject/ChangeScheduleDate',
                        method:'post',
                        data:{
	                        confirmTime:dataTimes,
                            period:that.dropIndex,
                            ListScheduleObj:that.allLists
                        }
                    }).then(response=>{
                        setTimeout(function () {
                            $('.el-table--scrollable-y .el-table__body-wrapper').animate({scrollTop: that.animateTOP}, 500)
                        },1000)
                        that.getList()
                        that.$message({
                            type: 'success',
                            message: '修改成功!'
                        })
                        that.onOfftime=false
                    }).catch(data=>{
                        that.onOfftime=false 
                    })
                    that.centerDialogVisible=false
                }
            }
            else{
                that.$notify({
                    title: '错误',
                    message: '仅允许在孕期内调整！',
                    type: 'warning'
                });
                that.Datevalue=''
            }
        },
        makeSure(item){    //点击切换完成状态
            let that=this;
            let isDow='';
            let state=null;
            if(item.State==0 || item.State==undefined){
                isDow='已完成'
                state=1
            }
            else{
                isDow='未完成'
                state=0
            }
            that.$confirm(`是否将事项${item.ScheduleName}状态修改为${isDow}`, '是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
                }).then(() => {
                    item.State=state;
                    let dataArray=[];
                    dataArray.push(item)
                    that.service({
                            url:'/ResearchObject/ChangeScheduleState',
                            method:'post',
                            data:{
                                listScheduleObj:dataArray
                            }
                        }).then(response=>{
                                this.$message({
                                    type: 'success',
                                    message: '修改成功!'
                                })
                                setTimeout(function () {
                                    $('.el-table--scrollable-y .el-table__body-wrapper').animate({scrollTop: that.animateTOP}, 500)
                                },1000)
                                that.getList()
                         }).catch(data=>{
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消'
                    });
            });
        },
        handleCommandSP(command){   //单个事项修改时间状态
            let that=this;
            that.addForm1={}
            if(command==1){   //点击修改时间
                let alength=that.tableData.length-1;
                let startTime=that.tableData[0].one.ScheduleDate;
                let lastTime='';
                if(that.userBasic.Period==2){
                    lastTime=that.tableData[alength-4].seven.ScheduleDate;
                }
                else{
                    lastTime=that.tableData[alength].seven.ScheduleDate;
                }
                that.defaultValue=[startTime,lastTime]
                that.centerDialogVisible=true
                that.Datevalue=''
            }
            else if(command==2){   //删除事项
                if(that.RoleGroup=='2'&&that.allLists[0].ScheduleState==1){           //管理员权限
                    this.$message({
                        type: 'info',
                        message: '暂无权限!'
                    })
                    return false;
                }
                if(that.RoleGroup>2){        //干预护士权限
                    this.$message({
                        type: 'info',
                        message: '暂无权限!'
                    })
                    return false;
                }
                let appont=""
                switch(that.allLists[0].State){
                    case '1':
                        appont="已完成";
                        break;
                    case '2':
                        appont="已取消";
                        break;
                    case '3':
                        appont="爽约";
                        break;
                    default :
                        appont="待完成";
                        break
                }
                that.$confirm(`该事项目前状态为${appont},确认要删除该事项吗?`, '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    that.service({
                            url:'/ResearchObject/DeleteSchedule',
                            method:'post',
                            data:{
                                SYS_ID:that.allLists[0].SYS_ID,
                                RoleGroup:that.RoleGroup
                            }
                        }).then(response=>{
                            that.$message({
                                type: 'success',
                                message: '修改成功!'
                            })
                            setTimeout(function () {
                                $('.el-table--scrollable-y .el-table__body-wrapper').animate({scrollTop: that.animateTOP}, 500)
                            },1000)
                            that.getList()
                        }).catch(data=>{
                                })
                }).catch(() => {
                        that.$message({
                            type: 'info',
                            message: '已取消'
                        });
                });
            }
            else{
                let strJson=that.allLists[0]
                that.addForm1=JSON.parse(JSON.stringify(strJson))
                that.addForm1.ActualFollowUpType = that.addForm1.ActualFollowUpType.trim()
                that.GetAppointTimes = ''
                that.GetChildoctTimes = ''
                that.MoreDialogVisible=true     //更多操作
                if(strJson.NeedFollowUp==1){
                    that.changeNurse(strJson.FollowUpNurse,'FollowUpNurseId','FollowUpDate','optionsNurse')
                }
                else if(strJson.NeedFollowUp==2){
                    that.changeNurse(strJson.NutritionServiceNurse,'NutritionServiceNurseId','VisitDate','optionsYingy')
                }
                else if(strJson.NeedFollowUp==5){
	                that.changeNurse(strJson.BreastFollowUpNurse,'BreastFollowUpNurseId','BreastFollowUpDate','optionsBr')
                }
                else if(strJson.NeedFollowUp==6){
	                that.changeNurse(strJson.DataCollectionNurse,'DataCollectionNurseId','DataCollectionAppointDate','optionsShuju')
                }
                else if(strJson.NeedFollowUp==7){
	                that.changeNurse(strJson.DietitianName,'PediatricianId','FatOutpatientAppointDate','optionsYingy')
	                that.changeNurse(strJson.PediatricianName,'PediatricianId','FatOutpatientAppointDate','optionChilddoc')
                }
                that.service({    //获取对象当日时间安排
                    url:'/ResearchObject/GetMyScheduleTime',
                    method:'get',
                    params:{
                        researchObjeactId:that.userBasic.SYS_ID,
                        scheduleDate:strJson.ScheduleDate||'1990-01-01'
                    }
                }).then(response=>{
                    that.GetMyScheduleTime=response.msg
                }).catch(data=>{

                })
            }
        },
        getDetails(list){   //获取item
	        console.log(list)
            this.allLists=[]
            this.allLists.push(list);
            this.timeSps=list.TimeSpan
            this.$nextTick(function(){
                this.$refs.addForm1.resetFields();
            })
            this.animateTOP=$('.el-table--scrollable-y .el-table__body-wrapper').scrollTop()  //获取点击时候滚动条滚动距离
        },
        handleCommand(command){    //修改时间，完成事项，添加事项
            let that=this;
            if(command==1){   //点击修改时间
                let alength=that.tableData.length-1;
                let startTime=that.tableData[0].one.ScheduleDate;
                let lastTime='';
                if(that.dropIndex==2 || that.userBasic.Period==2){
                    lastTime=that.tableData[alength-4].seven.ScheduleDate;
                }
                else{
                    lastTime=that.tableData[alength].seven.ScheduleDate;
                }
                that.defaultValue=[startTime,lastTime]
                that.centerDialogVisible=true
                that.Datevalue=''
            }
            else if(command==2){
            
                that.pageSize=5;
                that.pageCount=1;
                that.keyword=''
                that.multipleSelection=[]
                that.total=null;
                that.getBacklog()
                that.swDialogVisible=true
                that.$nextTick(() => {
                    that.$refs.multipleTable.clearSelection();
                });
            }
            else{                        //全部完成
                for(let i of that.allLists){  //遍历State
                    i.State=1
                }
                that.changeStateLIst()
            }
        },
        changeStateLIst(){   //修改状态
            let that=this;
            that.service({
                url:'/ResearchObject/ChangeScheduleState',
                method:'post',
                data:{
                    listScheduleObj:that.allLists
                }
            }).then(response=>{
                this.$message({
                        type: 'success',
                        message: '修改成功!'
                    })
                setTimeout(function () {
                    $('.el-table--scrollable-y .el-table__body-wrapper').animate({scrollTop: that.animateTOP}, 500)
                },1000)
                that.getList()
                }).catch(data=>{
            })
        },
        getItem(items){   //点击时获取所需要的item列表值
          this.allLists=''
          this.allLists=items.things;
          this.TFwrap.TimeSpan=items.inde;
          this.TFwrap.ScheduleDate=items.ScheduleDate;
          this.TimeSpan=items.inde;
          this.timeSps=items.inde;
          this.animateTOP=$('.el-table--scrollable-y .el-table__body-wrapper').scrollTop(); //获取点击时候滚动条滚动距离
        },
        resetShel(){  //重置日程
            let that=this;
            that.$confirm('将重置日程, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
                }).then(() => {
                that.loading=true
                that.service({
                        url:'/ResearchObject/CreateSchedule',
                        method:'post',
                        data:{
                            SYS_ID:that.userBasic.SYS_ID,
	                        OpId:that.token
                        }
                    }).then(response=>{
                        that.getList()
                        that.$message({
                            type: 'success',
                            message: '重置成功'
                        });
                    }).catch(data=>{
                        that.loading=false
                })
               }).catch(() => {
                    that.$message({
                        type: 'info',
                        message: '已取消'
                    });
            });
        },
        async getList(changeIndex){           //获取一级信息列表
            let that=this
            that.userBasic=''
            that.tableData=[];
            that.dataFocus = ''
            that.emptyText="暂无日程";
            that.loading=true
            that.total=null
            if(that.resechObj.mobile ||that.resechObj.researchNo){
                that.sysId='';
                that.mobile=that.resechObj.mobile;
                that.researchNo=that.resechObj.researchNo;
            }
            await that.service({
                url:'/ResearchObject/GetParticipantDetail',
                method:'get',
                params:{
                    itemType:'3',
                    sysId:'',
                    period:changeIndex||'',
                    researchObjectId:that.sysId,
                    mobile:that.mobile,
                    researchNo:that.researchNo,
                    pageCount:0,
                    pageSize: 100,
                }
            }).then(response=>{
                console.log(response)
                if(response.dtData.dtBasic.length<=0){
                    that.loading=false
                    return false
                }
                response.dtData.dtBasic[0]?that.userBasic=response.dtData.dtBasic[0]:''
                
                if(response.dtData.dtSchedule.length>0){         //如果日程有数据，则进行计算，避免判断null值
                    that.arrayYun=response.dtData.dtSchedule
                    that.computedYun(changeIndex)
                }
                else{
                    if(changeIndex==1){
                        that.emptyText="暂无孕前期日程"
                    }
                    that.arrayYun=[]
                }
                that.loading=false
                //当前阶段定位
                if(that.userBasic.Period == 2){
                    that.$nextTick(() =>{
                     let top = $(`.A${that.yunzhou - 5}`).offset().top - 399
                     setTimeout(function () {
                        $('.el-table--scrollable-y .el-table__body-wrapper').animate({scrollTop: top}, 500)
                     },1000)
                    })
                    
                }
                else if(that.userBasic.Period >= 3){
                   
                    that.$nextTick(() =>{
                        let num = parseInt((WeeksBetw(new Date,that.userBasic.ChildBirthDate))/7) - (that.userBasic.Period == 4 ?156 :0)
                        let top = $(`.A${num}`).offset().top - 399
                         console.log(num)
                        setTimeout(function () {
                        $('.el-table--scrollable-y .el-table__body-wrapper').animate({scrollTop: top}, 500)
                        },1000)
                    })
                }
               
            }).catch(data=>{
                that.loading=false
            })
        },
        computedYun(changeIndex){   //   计算公式
            let that=this;
            that.loading=true
            let firstDate;
            let lastDate;
            let dataTime;
            let tableArray=[];
            let userPeriod=that.userBasic.Period;
            if(changeIndex){
                userPeriod=changeIndex
            }
            if(userPeriod==1){    //孕前期  0-52周
                firstDate=0;
                lastDate=52;
                that.tableList={
                    one:'周一',
                    two:'周二',
                    three:'周三',
                    four:'周四',
                    five:'周五',
                    six:'周六',
                    seven:'周日'
                }
                dataTime=new Date(that.userBasic.ConfirrmTime);
                dataTime=setDate(dataTime,-(dataTime.getDay()-1),0);
	            tableArray=takeArray(firstDate,lastDate,dataTime,'第')
                for(let item of that.arrayYun){
                	try{
		                if(item.TimeSpan<0 ||item.TimeSpan>52 || isNaN(item.TimeSpan)){
			                console.log('接口有错误数据,已过滤')
		                }
		                else{
			                let index=0;
			                let keyIndex='';
			                index=(WeeksBetw(item.ScheduleDate,dataTime))%7 //求余数
			                keyIndex=Object.keys(tableArray[item.TimeSpan])[index+1] //获取key值
			                tableArray[item.TimeSpan][keyIndex].things.push(item)  //相同放进数组里
		                }
                    }catch(e) {
                        console.log(e)
	                }
                }
                that.tableData=tableArray
            }
            else if(userPeriod==2){
                firstDate=5; lastDate=41;    //怀孕期  5-41周
                let dateAlary=new Date(that.userBasic.ExpectedDate)
                dataTime=dateForm(dateAlary.setMonth(dateAlary.getMonth()-9,dateAlary.getDate()-7));
                that.tableList={
                    one:'+0',
                    two:'+1',
                    three:'+2',
                    four:'+3',
                    five:'+4',
                    six:'+5',
                    seven:'+6'
                }
	            tableArray=takeArray(firstDate,lastDate,dataTime,'孕')
                tableArray.push({week:'分娩前', one:{ScheduleDate:'', inde:42, things:[]}});   //机械添加固定栏目
                tableArray.push({week:'分娩后', one:{ScheduleDate:'', inde:43, things:[]}});
                tableArray.push({week:'产科病房',one:{ScheduleDate:'',inde:44, things:[]}});
                tableArray.push({week:'产后42天门诊',one:{ScheduleDate:'', inde:45, things:[]}});
                for(let item of that.arrayYun){
                    let index=0;
                    let keyIndex='';
                    try{
	                    if(item.ScheduleDate!==undefined&&(item.TimeSpan<42)){      //正常天数 怀孕期
		                    if(item.TimeSpan<5 || isNaN(item.TimeSpan)){  //过滤不正常数据
			                    console.log(item)
			                    console.log('接口有错误数据,已过滤')
		                    }
		                    else{
			                    index=(WeeksBetw(item.ScheduleDate,dataTime))%7 //求余数
			                    keyIndex=Object.keys(tableArray[item.TimeSpan-5])[index+1] //获取key值
			                    tableArray[item.TimeSpan-5][keyIndex].things.push(item)  //相同放进数组里
		                    }
	                    }
	                    else{               //分娩
		                    if(item.TimeSpan>45 || isNaN(item.TimeSpan)){  //过滤不正常数据
			                    console.log('接口有错误数据,已过滤')
		                    }
		                    else{
			                    tableArray[item.TimeSpan-5].one.things.push(item)
		                    }

	                    }
                    }catch(e) {
                        console.log(e)
                    }

                }
                that.tableData=tableArray
                that.loading=false
            }
	        else if(userPeriod==3){    //儿童期1  0-160周
		        firstDate=0;
		        lastDate=160;
		        that.tableList={
			        one:'周一',
			        two:'周二',
			        three:'周三',
			        four:'周四',
			        five:'周五',
			        six:'周六',
			        seven:'周日'
		        }
                let isSunday=new Date(that.userBasic.ChildBirthDate).getDay()
                isSunday=='0'? dataTime=new Date(dateForm(new Date(that.userBasic.ChildBirthDate).getTime()-24*60*60*1000))
                    :dataTime=new Date(that.userBasic.ChildBirthDate)//特殊情况减一天
		        dataTime=setDate(dataTime,-(dataTime.getDay()-1),0);
		        tableArray=takeArray(firstDate,lastDate,dataTime,'第')
		        for(let item of that.arrayYun){
                    try{
	                    if(item.TimeSpan<0 ||item.TimeSpan>160 || isNaN(item.TimeSpan)){
		                    console.log('接口有错误数据,已过滤')
	                    }
	                    else{
		                    let index=0;
		                    let keyIndex='';
		                    index=(WeeksBetw(item.ScheduleDate,dataTime))%7 //求余数
		                    keyIndex=Object.keys(tableArray[item.TimeSpan])[index+1] //获取key值
		                    tableArray[item.TimeSpan][keyIndex].things.push(item)  //相同放进数组里
	                    }
                    }catch(e) {
                        console.log(e)
                    }
		        }
		        that.tableData=tableArray
	        }
            else if(userPeriod == 4){ //儿童期2  156-265  //这里需要确定第一个timeSpan到底从哪开始0或者156
                firstDate=156;
		        lastDate=265;
		        that.tableList={
			        one:'周一',
			        two:'周二',
			        three:'周三',
			        four:'周四',
			        five:'周五',
			        six:'周六',
			        seven:'周日'
		        }
                let isSunday=new Date(that.userBasic.ChildBirthDate).getDay()
                isSunday=='0'? dataTime=new Date(dateForm(new Date(that.userBasic.ChildBirthDate).getTime()-24*60*60*1000))
                    :dataTime=new Date(that.userBasic.ChildBirthDate)//特殊情况减一天
		        dataTime=setDate(dataTime,-(dataTime.getDay()-1),0);
		        tableArray=takeArray(firstDate,lastDate,dataTime,'第')
		        for(let item of that.arrayYun){
                    try{
	                    if(item.TimeSpan<0 ||item.TimeSpan>265 || isNaN(item.TimeSpan)){
		                    console.log('接口有错误数据,已过滤')
	                    }
	                    else{
		                    let index=0;
		                    let keyIndex='';
		                    index=(WeeksBetw(item.ScheduleDate,dataTime))%7 //求余数
		                    keyIndex=Object.keys(tableArray[item.TimeSpan - 156])[index+1] //获取key值
		                    tableArray[item.TimeSpan - 156][keyIndex].things.push(item)  //相同放进数组里
	                    }
                    }catch(e) {
                        console.log(e)
                    }
		        }
		        that.tableData=tableArray
            }
        }
    },
    async mounted(){
        let that=this;
        that.sysId=that.$route.query.id;
        that.mobile=that.$route.query.mobile;
        that.researchNo=that.$route.query.researchNo;
        await that.getList()  //初始化数据
	    // let isOpen = this.$store.state.app.sidebar.opened
	    // setTimeout(() =>{
		//     isOpen ? this.$store.state.app.sidebar.opened = false :null
	    // },500)
        that.GetNurse()  //获取护士选项
    },
    filters:{
        FollowUpTypeFilter(cellValue){
                return cellValue==1?'面对面':cellValue==2?'电话' : cellValue==3?'面对面/电话':"面对面/电话"
            },
        GroupType:function(val){
            if(val=='' ||val==undefined) return ''
            return val=='1'?'A': 'B'
        },
        IntensityOfIntervention:function(val){
            return filterIntensityOfIntervention(val)
        },
        Period:function(val){
            return filterPeriod(val)
        },
        ChildSex(val){
	        return val=='1'?'男':val=='2'?'女':'未知'
        }
    }
  }
//临时工具函数
function addZero(s){
    return s < 10 ? '0' + s: s;
}
function setDate(dataTime,n,m){
    var times=new Date(dataTime)
    times.setDate(times.getDate()+n+m*7); //增加一天
    return dateForm(times)
}
function dateForm(data){   //日期格式化
    return   new Date(data).getFullYear()+'-'+addZero((new Date(data).getMonth()+1))+'-'+addZero(new Date(data).getDate())
}
function WeeksBetw(date1,date2) {  //计算日期之间相差得天数
    var _dt1=new Date(date1);
    var _dt2=new Date(date2);
    var dt1=_dt1.getTime();
    var dt2=_dt2.getTime();
    return parseInt(Math.abs(dt1- dt2)/1000/60/60/24);//这里是计算天数,如果想获得周数则在该返回值上再除以7
}
function takeArray(firstDate,lastDate,dataTime,unit,start = 0) {
	let tableArray=[];
	for(let i=firstDate;i<=lastDate;i++){
		let weekObj={
			week:unit+i+'周',
			one:{
				ScheduleDate:setDate(dataTime,0,i),
				inde:i -start,
				things:[]
			},
			two:{
				ScheduleDate:setDate(dataTime,1,i),
				inde:i-start,
				things:[]
			},
			three:{
				ScheduleDate:setDate(dataTime,2,i),
				inde:i-start,
				things:[]
			},
			four:{
				ScheduleDate:setDate(dataTime,3,i),
				inde:i-start,
				things:[]
			},
			five:{
				ScheduleDate:setDate(dataTime,4,i),
				inde:i-start,
				things:[]
			},
			six:{ 
				ScheduleDate:setDate(dataTime,5,i),
				inde:i-start,
				things:[]
			},
			seven:{
				ScheduleDate:setDate(dataTime,6,i),
				inde:i-start,
				things:[]
			}
		}
		tableArray.push(weekObj)
	}
	return tableArray
}
</script>
<style scoped lang="scss">
   .userDate{
       .headerTop {
           margin-bottom: 30px;
           p {
               font-size: 16px;
               margin-bottom: 15px;
               color: #303133;
               span {
                   padding: 10px;
               }
               .span1 {
                   margin-left: 25px;
               }

           }
        }
       .heaterOp{
           margin-top: -35px;
           cursor: pointer;
           float: right;
           color: #5D8DFF;
       }
       .DateTemplate{
           .temp_top{
               background: #F5F7FB;
               ul{
                   display:flex;
                   li{
                       flex:1;
                       text-align: center;
                       height: 50px;
                       line-height: 50px;
                       color: #333333;
                       font-size: 14px;
                   }
               }
           }
           .temp_center{
               background: #F5F7FB;
               ul{
                   display:flex;
                   li{
                       flex:1;
                       text-align: center;
                       color: #333333;
                       font-size: 14px;
                       min-height: 150px;
                       position: relative;
                       .zhou{
                           position: absolute;
                           top: 40%;
                           left: 0;
                           right: 0;
                           text-align: center;
                       }
                   }
               }
           }
       }
   }
   .addIocn{color:#DDDDDD;font-size: 40px;text-align: center;font-weight: 100;position: absolute;
       top: 35%;left:0;right: 0;font-size: 25px;}
    .span-radio{width: 10px;height: 10px;border-radius: 10px;display: inline-block;margin-right: 3px;background: #ccc}
    .color-check{font-size: 16px;}
    .iconOne{color:#606266}
    .iconOnes{color:#DDE0E7}
    .iconTwo{color:green}
    .iconThr{color: blue}
    .scopeUl{
        text-align: left;
        margin-top:25px;
        li{
            padding:0px 5px;
            cursor: pointer;
        }
    }
   .scopeDrop{position: absolute;top:10px;left:0;right:0;}
   .scopeDrop span{cursor: pointer}
    .el-icon-plus{font-size: 26px;color: #DDDDDD;cursor: pointer}
   .headerTop_ukl{
       /*border:1px solid #EDF1F7;*/
       padding:5px 20px 10px 0px;
       min-width:800px;
       font-size:14px;
       width:1000px;
       ul{
           li{
               float: left;
               margin-right: 50px;
                   .p1{
                       color:#999999;
                       padding-bottom:5px;display: inline-block;
                       img{
                           display: inline-block;margin-right: 10px;
                       };

                    }
                   .p3{
                       display: inline-block;
                       padding-left: 10px;
                       color: #666;
                   }
        }
       }
   }
   .query-area {
       display: flex;
       width: 50%;
       margin-bottom: 10px;
   }
   .img-follow {
       padding: 1px 3px 0 2px;
       vertical-align: -2px;
   }
</style>
